package com.xiaoge;

import com.xiaoge.service.UserService;
import com.xiaoge.service.UserServiceImpl;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.io.Resource;

import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;

/**
 * TODO
 *
 * @author <a href="mailto:1330137071@qq.com">Zhang Xiao</a>
 * @since
 */
public class ZhangXiaoAopApplication {
	public static void main(String[] args) throws IOException {
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class);
		UserService userService = (UserService)applicationContext.getBean(UserService.class);
//		UserServiceImpl userService = (UserServiceImpl)applicationContext.getBean(UserServiceImpl.class);
		userService.test();

		// todo 记载资源
//		Resource resource = applicationContext.getResource("https://www.baidu.com");
//		byte[] bytes = new byte[10000];
//		resource.getInputStream().read(bytes);
//		System.out.println(Arrays.asList(new String(bytes).split("\r\n")));
//		System.out.println(resource.contentLength());
//		System.out.println();
//		System.out.println(resource.getDescription());

		// todo 发布事件
//		applicationContext.publishEvent("1111");
	}
}